package com.dongdongkeji.wangwangsocial.ui.login;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.load.resource.drawable.GlideDrawable;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
import com.dongdongkeji.base.common.MvpActivity;
import com.dongdongkeji.base.image.ImageLoader;
import com.dongdongkeji.base.utils.ToastUtils;
import com.dongdongkeji.wangwangsocial.R;
import com.dongdongkeji.wangwangsocial.ui.login.presenter.TestPresenter;
import com.dongdongkeji.wangwangsocial.ui.login.view.TestView;

import butterknife.BindView;
import butterknife.OnClick;

public class TestActivity extends MvpActivity<TestPresenter> implements TestView {

    @BindView(R.id.iv_image)
    ImageView ivImage;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    protected int appointLayoutId() {
        return R.layout.activity_test;
    }

    @Override
    protected TestPresenter createPresenter() {
        return new TestPresenter(this, disposables);
    }

    @OnClick({R.id.btn_login, R.id.btn_load})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.btn_login:
                presenter.login("15882370797", "123456");
                break;
            case R.id.btn_load:
                ImageLoader.getInstance().loadQiNiuImage(this, ivImage, "http://resouce.dongdongwedding.com/Fq1VV3BIDV6YHymj7-5vjp_kIMgM",
                        80, 80, R.mipmap.ic_launcher, R.mipmap.ic_launcher);
                break;
        }
    }

    @Override
    public void showResult(boolean isSuccess) {
        if (isSuccess){
            ToastUtils.showShort("登录成功");
        }else {
            ToastUtils.showShort("登录失败");
        }
    }
}
